package cn.iocoder.yudao.module.contract.dal.mysql.company;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.contract.dal.dataobject.company.CompanyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.contract.controller.admin.company.vo.*;

/**
 * 公司 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CompanyMapper extends BaseMapperX<CompanyDO> {

    default PageResult<CompanyDO> selectPage(CompanyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyDO>()
                .eqIfPresent(CompanyDO::getCompanyCode, reqVO.getCompanyCode())
                .likeIfPresent(CompanyDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(CompanyDO::getAddress, reqVO.getAddress())
                .eqIfPresent(CompanyDO::getLegalPerson, reqVO.getLegalPerson())
                .eqIfPresent(CompanyDO::getPhone, reqVO.getPhone())
                .eqIfPresent(CompanyDO::getFaxes, reqVO.getFaxes())
                .likeIfPresent(CompanyDO::getBankName, reqVO.getBankName())
                .eqIfPresent(CompanyDO::getBankAccount, reqVO.getBankAccount())
                .eqIfPresent(CompanyDO::getTaxNumber, reqVO.getTaxNumber())
                .eqIfPresent(CompanyDO::getSigningAddress, reqVO.getSigningAddress())
                .betweenIfPresent(CompanyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CompanyDO::getId));
    }

}